home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 August: Tool Chest / Dev.CD Aug 98 TC.toast / Tool Chest / Testing & Debugging / Virtual User / Virtual User Current Release / Examples / Example Scripts / SimpleSample2.vu < prev   
Encoding:
Text File  |  1998-06-04  |  3.2 KB  |  106 lines  |  [TEXT/MPS ]

  1. #
  2. #    File:        SimpleSample2.vu 
  3. #
  4. #    Contains:    A script that will do some actions with a few control panels,
  5. #                page setup and some other Finder actions.
  6. #
  7. #    Notes:        The settings for the page setup dialog control may need to be
  8. #                adjusted for you specific configuration.  Most of the actions
  9. #                performed in this script require System 7.  If System 7 is not
  10. #                present, SimpleSample2 will only work with the Page Setup
  11. #                dialog.  If the printer driver specified in the PageSetup
  12. #                call differs from the one selected by Chooser, results may
  13. #                not be what you would expect.
  14. #
  15. #    Written by:    David Gaxiola
  16. #
  17. #    Copyright:    © 1992 by Apple Computer, Inc., all rights reserved.
  18. #
  19. #    Change History:
  20. #
  21. #             1/17/97    AR        Added comments
  22. #             8/19/92    DGG        Made into parametric script and added more printing
  23. #                                comments.
  24. #              7/6/92    DGG        Created
  25. #
  26. #    To do:
  27. #
  28.  
  29. Libraries "ControlPanels.vulib", "QuickTasks.vulib", "StandardDialogs.vulib", 
  30.             "UtilityTasks.vulib";
  31.  
  32. script SimpleSample2Main()
  33. begin
  34.     Using7 := RunningSystemSeven();
  35.  
  36.     MouseSpeed(10);
  37.  
  38.     TwitchApp();
  39.  
  40.     # Perform some simple manipulations on a few control panels.
  41.     # Note that none of the control panels are automatically closed by the
  42.     # CDEV tasks.  The scripters has to do this themselves.
  43.     if (Using7)
  44.     begin
  45.         LogNormal("Working on Monitors control panel: default operations");
  46.         MonitorsCDEV();
  47.         close [window t:"Monitors" o:1];
  48.         LogNormal("Working on Sharing Setup control panel: default operations");
  49.         SharingSetupCDEV();
  50.         close [window t:"Sharing Setup" o:1];
  51.         LogNormal("Working on Views control panel: Chicago 12, show nothing, always snap, meduim icon");
  52.         ViewsCDEV("Chicago", "12", "shownothing", "alwayssnap", "medium");
  53.         close [window t:"Views" o:1];
  54.         LogNormal("Working on Monitors control panel: set to color");
  55.         MonitorsCDEV("color");
  56.         close [window t:"Monitors" o:1];
  57.         LogNormal("Working on Views control panel: default operations");
  58.         ViewsCDEV();
  59.         close [window t:"Views" o:1];
  60.     end;
  61.  
  62.     # Don't forget to make the settings specific to your setup!
  63.     # You may use Chooser to select an appropriate driver.
  64.     LogNormal("Running Page Setup operations.");
  65.     PageSetup("LaserWriter", "USLegal", 60, "portrait");
  66.     wait (10);
  67.  
  68.  
  69.     # SimpleSample2 will try to find the Virtual User Agent on the target.
  70.     if (Using7)
  71.     begin
  72.         LogNormal("Trying to find ∂'Agent VU∂'.");
  73.         previousWindow := match [window o:1];
  74.         select [menuItem t:/Find≈/ m:"File"];
  75.         type k:{"Agent VU", enterKey};
  76.  
  77.         wait(1);
  78.         thisWindow := match [window o:1];
  79.         stillSearching := true;
  80.         # A search may not find anything or it may take a long time.  This is one way 
  81.         # of dealing with the different outcomes.
  82.         while stillSearching
  83.         begin
  84.             if (thisWindow.s = dialog)
  85.                 stillSearching := false;
  86.             else if (thisWindow.t = "Find")
  87.                 stillSearching := true;
  88.             else if (thisWindow = previousWindow)
  89.                 stillSearching := true;
  90.             else
  91.                 stillSearching := false;
  92.             wait(1);
  93.             thisWindow := match [window o:1];
  94.         end;
  95.  
  96.         if (thisWindow.s = dialog)
  97.         begin
  98.             select [button t:"Ok" w:[window o:1]];
  99.             LogError("Did you rename you VU Agent???");    
  100.         end;
  101.         else if (previousWindow = thisWindow)
  102.             LogNormal("It was already open!!!");
  103.         else
  104.             LogNormal("Agent VU found!");
  105.     end; # if (Using7)
  106. end; # SimpleSample2